package server;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;

public class ServerThread extends Thread {
	private Socket clientSocket;

	public ServerThread(Socket clientSocket) {
		this.clientSocket = clientSocket;
	}

	@Override
	public void run() {
		try {
			DataInputStream dataInputStream = new DataInputStream(
					clientSocket.getInputStream());
			DataOutputStream dataOutputStream = new DataOutputStream(
					clientSocket.getOutputStream());
			while (true) {
				String in = dataInputStream.readUTF();
				dataOutputStream.writeUTF("echo: " + in);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
